package com.hadwinling.blog.mapper;

import com.hadwinling.blog.entity.Admin;
import org.apache.ibatis.annotations.Mapper;import org.apache.ibatis.annotations.Param;import java.util.List;

/**
 * @author HadwinLing
 * @version V1.0
 * @Package com.hadwinling.blog.mapper
 * @date 2020/8/23 17:45
 */
@Mapper
public interface AdminMapper {
    /**
     * delete by primary key
     *
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     *
     * @param record the record
     * @return insert count
     */
    int insert(Admin record);

    /**
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(Admin record);

    /**
     * select by primary key
     *
     * @param id primary key
     * @return object by primary key
     */
    Admin selectByPrimaryKey(Integer id);

    /**
     * update record selective
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(Admin record);

    /**
     * update record
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(Admin record);

    /**
     * selectOneByAdminnameAndPasswordAndState
     *
     * @param adminname
     * @param password
     * @param state
     * @return
     */
    Admin selectOneByAdminnameAndPasswordAndState(@Param("adminname") String adminname, @Param("password") String password, @Param("state") int state);

    List<Admin> selectByAdminname(@Param("adminname") String adminname);

    List<Admin> selectByTell(@Param("tell") String tell);

    List<Admin> selectByAdminnameAndPassword(@Param("adminname") String adminname, @Param("password") String password);

    Admin selectOneByAdminnameAndPassword(@Param("adminname") String adminname, @Param("password") String password);

    int updatePhotoById(@Param("updatedPhoto") String updatedPhoto, @Param("id") Integer id);

    int updatePasswordById(@Param("updatedPassword") String updatedPassword, @Param("id") Integer id);

    Admin selectOneByAdminnameAndPasswordAndIsadminAndState(@Param("adminname")String adminname,@Param("password")String password,@Param("isadmin")Integer isadmin,@Param("state")Integer state);


}